home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tvg110.zip / TVGRAPH.DOC < prev    next >
Text File  |  1993-02-22  |  6KB  |  186 lines

  1.                               TVGRAPH 1.10
  2.                               TURBO VISION
  3.                   using TURBO VISION In EGA/VGA graphics
  4.                            (C) Mindware 1991,1993
  5.                          Brisbane,QLD,Australia
  6.                            Fido : 3:640/307
  7.  
  8. 0. See Modified TVDEMO program and STYX.PAS to show you how to do things
  9.  
  10. 1. All that is required is to include TVGRAPH in the uses statement in your
  11. main program and amazing - TV will work in graphics mode.
  12.  
  13. 2. Declarations are as follows
  14.  
  15. type
  16.  PGRect=^GRect;
  17.  GRect=Trect;
  18.  
  19.  PGPoint=^GPoint;
  20.  GPoint=TPoint;    (* These two just to avoid confusion *)
  21.  
  22. 3. Graphics IDs
  23. All "text" windows are given a graphics ID of 0, each window you want
  24. to use graphics in - you need to assign a graphics ID to it, if a line is
  25. drawn using the internal RawDrawLine - then if the current graphics window
  26. is the same as the location you are writing to on the screen then the graphics
  27. will overwrite - else the graphics will be clipped.
  28.  
  29. function NextGraphId:byte; (* Get next available graphics id *)
  30. procedure UseGraphId(b:byte); (* Use graphics ID for following graphics *)
  31. procedure ReleaseGraphId(b:byte); (* release graphics ID for use *)
  32.  
  33. To assign a graphics id to a character cell ensure you write character n with
  34. attribute 0FFh into the location using standard TURBO VISION methods.
  35.  
  36.  
  37. 4. Working with BGI
  38. You can use BGI routines without initialising, TVgraph has already done that.
  39. Warning TVision will overwrite BGI graphics and vice-versa.
  40.  
  41. 5. Interface Sections :
  42. --------------------------- TVGRAPH ---------------------------------------
  43. const
  44.   cmTvGraphDraw = 1991;  (* Send this to a TVGView to draw the view *)
  45.   cmTvGraphProd = 1992;  (* Send this to a TVGView to prod the view *)
  46.  
  47. type
  48.   PTVGApp = ^TVGApp;
  49.   TVGApp = object(TProgram)
  50.     constructor Init;
  51.     destructor Done; virtual;
  52.     procedure SetScreenMode(Mode: Word);
  53. {$IFDEF Ver70}
  54.     procedure Cascade;
  55.     procedure DosShell;
  56.     procedure GetTileRect(var R: TRect); virtual;
  57.     procedure HandleEvent(var Event: TEvent); virtual;
  58.     procedure Tile;
  59.     procedure WriteShellMsg; virtual;
  60. {$ENDIF}
  61.   end;
  62.  
  63.   PTVGView = ^TVGView;
  64.   TVGView = object(TView)
  65.     GraphWindowId:byte;
  66.     constructor Init(Var Bounds:Trect);
  67.     destructor Done;virtual;
  68.     procedure Prod; virtual;
  69.     procedure GraphDraw; virtual;
  70.     procedure Draw; virtual;
  71.     procedure GetGraphBounds(var R:GRect);
  72.     procedure GetGraphClipRect(var R:GRect);
  73.     procedure HandleEvent(var Event:TEvent); virtual;
  74.   end;
  75.  
  76.   PTVGWindow = ^TVGWindow;
  77.   TVGWindow = object(TWindow)
  78.     constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Integer);
  79.   end;
  80.  
  81. --------------------------- TVGDEFS ---------------------------------------
  82. {$IFDEF Ver60}
  83. const
  84.   Seg0040=$0040;
  85.   SegA000=$A000;
  86. {$ENDIF}
  87.  
  88. const
  89.   GraphXMax=10000;
  90.   GraphYMax=07500;
  91.   smEGA = $1010;
  92.   smVGA = $1012;
  93.   smGraphAutoDetect=$10FF;   (* Autodetect *)
  94.   wrmOVERWRITE = 0;
  95.   wrmAND = 1;
  96.   wrmOR = 2;
  97.   wrmXOR = 3;
  98.  
  99. const
  100.   BGIPath:string='';
  101.   CurrentGraphWindow:byte=1;
  102.   CurrentLineStyle:word=$FFFF;
  103.                         (* Current Line style in 1=line 0=no line       *)
  104.   CurrentLineWriteMode:byte=$00;
  105.                         (* Current Write mode for lines                 *)
  106.   TVgraphCheckSnow:byte=101;
  107.                         (* Set Checksnow to this to start the graphics  *)
  108.                         (* Version of REP STO                           *)
  109. type
  110.   PGRect=^GRect;
  111.   GRect=Trect;
  112.  
  113.   PGPoint=^GPoint;
  114.   GPoint=TPoint;
  115.  
  116. var
  117.   CharWidth,CharHeight:byte;
  118.                         (* Width and Height in text mode                *)
  119.   GraphWidth,GraphHeight:word;
  120.                         (* Width and height in graphics                 *)
  121.   TvGraphLoc,TvGraphCursor:word;
  122.                         (* Store current text x,y and top/bottom cursor *)
  123.   GraphMouseLoc:TPoint; (* Graphics location of Mouse *)
  124.   TVGraphVideoMode:word;
  125.   BytesPerLine:word;    (* Bytes per line in graphics mode              *)
  126.   SaveJump:word;        (* Save jump location for GraphMov              *)
  127.   FontTable:ABitFont;   (* In Memory font table                         *)
  128.   PtrFontTable:PABitFont;(* Pointer to In Memory font table             *)
  129.   GraphWriteAvail:array[0..4095] of byte;
  130.   (* one byte for each text position on the screen, 0=text screen and   *)
  131.   (* a number 1-254 representing distinct graphics windows and 255      *)
  132.   (* represents the mouse cursor positions                              *)
  133.   GraphIdSet:set of byte;
  134.   VideoBufferSeg:word;  (* Video Segment for display *)
  135.  
  136. procedure GlobalToPhysical(Var X,Y:integer);
  137. procedure PhysicalToGlobal(Var P:GPoint);
  138. procedure TextToGraphics(T:TRect;var G:GRect);
  139.  
  140. function NextGraphId:byte;
  141. procedure UseGraphId(b:byte);
  142. procedure ReleaseGraphId(b:byte);
  143. function GraphIdAt(X,Y:integer):byte;
  144.  
  145. procedure MouseCursorOff;
  146. procedure MouseCursorOn;
  147. procedure ResetMouse;
  148.  
  149. --------------------------- TVGWHIZ ---------------------------------------
  150. procedure DrawLine(X1,Y1,X2,Y2:integer;Color:word);
  151. procedure RawDrawLine(X1,Y1,X2,Y2:integer;Color:word);
  152.  
  153. ---------------------------------------------------------------------------
  154.  
  155. TVGDEMEX.ZIP
  156.  
  157.  168752  TVDEMO.EXE             Compiled demo in real mode TP7/BP7
  158.  
  159. T6DEMSRC.ZIP
  160.  
  161.    3553  STYX.PAS               STYX.PAS for Turbo 6 TVDEMO
  162.   18013  TVDEMO.PAS             TVDEMO.PAS modified Turbo 6 Turbo Vision
  163.  
  164. T6DEMBIN.ZIP
  165.  
  166.    4256  TVGDEFS.TPU            ] Demo
  167.    5760  TVGDRIVE.TPU           ] Units
  168.   10928  TVGRAPH.TPU            ] Compiled
  169.    4000  TVGWHIZ.TPU            ] For TP6
  170.  
  171. B7DEMBIN.ZIP
  172.  
  173.    3728  TVGDEFS.TPU            ] Demo
  174.    3616  TVGDRIVE.TPU           ] Units
  175.    9056  TVGRAPH.TPU            ] Compiled
  176.    2336  TVGWHIZ.TPU            ] For TP7 real mode
  177.    3728  TVGDEFS.TPP            ] Demo
  178.    3616  TVGDRIVE.TPP           ] Units
  179.    9168  TVGRAPH.TPP            ] Compiled
  180.    2352  TVGWHIZ.TPP            ] For BP7 protected mode
  181.  
  182. B7DEMSRC.ZIP
  183.  
  184.   19714  TVDEMO.PAS             TVDEMO.PAS modified TP7/BP7 Turbo Vision
  185.    3548  STYX.PAS               STYX.PAS for Turbo 7/BP 7 TVDEMO
  186.